package Command;

import com.alibaba.fastjson.JSON;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.Objects;

@Getter
@Setter
public class SetCommand extends AbstractCommand {

    private String key;

    private String value;




    public SetCommand(String key,String value) {
        super(CommandTypeEnum.SET);
        this.key = key;
        this.value = value;
    }

    public SetCommand(String key,String value,long updateTime) {
        super(CommandTypeEnum.SET,updateTime);
        this.key = key;
        this.value = value;
    }

    public SetCommand(String key, String value, long updateTime, int ExpireTime) {
        super(CommandTypeEnum.SET,updateTime,ExpireTime);
        this.key = key;
        this.value = value;
    }

    public SetCommand(String path,String key, String value) {
        super(CommandTypeEnum.SET,path);
        this.key = key;
        this.value = value;
    }

    public SetCommand(String path,String key, String value,String ExpireTime) {
        super(CommandTypeEnum.SET,path,Long.parseLong(ExpireTime));
        this.key = key;
        this.value = value;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SetCommand that = (SetCommand) o;
        return Objects.equals(key, that.key);
    }

    @Override
    public int hashCode() {
        return Objects.hash(key);
    }
}
